﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InHosptialMoneyDetials.aspx.cs" Inherits="Page_Customer_InHosptialMoneyDetials" %>

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <title>住院费用一日清</title>
    <link href="../../Content/syzyy/css/reset.css" rel="stylesheet" />
    <link href="../../Content/syzyy/css/ylt_common.css" rel="stylesheet" />
    <link href="../../Content/syzyy/css/mobiscroll_date.css" rel="stylesheet" />
    <link href="../../layui/css/layui.css" rel="stylesheet" />
    <script src="../../Scripts/jquery-1.8.0.min.js"></script>
    <script src="../../Content/syzyy/js/mobiscroll_date.js"></script>
    <script src="../../Content/syzyy/js/mobiscroll.js"></script>
    <script src="../../layui/layui.js"></script>
    <style type="text/css">
        body {
            background-color: #fff;
        }

        .u_blank_list .u_bg_txt {
            background-image: url(/Content/syzyy/img/icon_calendar@2x.png);
            background-repeat: no-repeat;
            background-size: 10% 100%;
            background-position: 100% 0;
        }

        .pd_list li {
            border-bottom: 1px solid #E5E5E5;
            overflow: hidden;
        }

        .pd_list span {
            float: left;
            width: 25%;
            text-align: center;
            font-family: "microsoft yahei";
            font-size: 3rem;
        }

        .pd_list .tb_head {
            padding: 3% 3%;
        }

        .pd_list .tb_body {
            padding: 2.5% 3%;
        }

        .pd_list .hj {
            padding: 3% 3%;
        }

        .page_msg_nodate {
        }

        /*无报告时的样式*/
        .no_fee_bg {
            text-align: center;
            margin-top: 35%;
        }

        .tips {
            text-align: center;
            line-height: 3.5rem;
            font-size: 3rem;
            font-family: "microsoft yahei";
            margin-top: 10%;
        }

            .tips strong {
                font-size: 2.8rem;
                font-weight: normal;
            }

            .tips span {
                font-size: 2.5rem;
            }
    </style>

</head>
<body>
    <section class="u_blank patient_info">
        <% if (Model != null)
            {%>
        <div class="u_head">
            <img src="../../Content/syzyy/img/redIcon.png" />
            <span class="u_head_vl patient_name"><%=Model.PatientName %></span>
        </div>
        <%} %>

        <ul class="u_blank_list">
            <li class="f-flex">
                <span class="u_list_tit">时间:</span>
                <input type="text" name="USER_AGE" id="USER_AGE" readonly="" class="u_list_vl u_bg_txt f-flex1" value="">
            </li>
        </ul>
    </section>
    <section class="AddDetial">
    </section>


    <section class="nohide" style="display: none">
        <header class="no_fee_bg">
            <img src="../../Content/syzyy/img/no_report.png" />
        </header>
        <p class="tips">暂时未查询到您的当日住院费用</p>
    </section>
    <section class="loading" style="display: none">
        <header class="no_fee_bg">
            <img src="../../Content/syzyy/img/loading.gif" />
        </header>
    </section>

    <script type="text/javascript">
        function subText() {
            $("#tb_body f-flex span").each(function () {
                var i = 1;
                $(this).children().each(function () {
                    if (i % 2 == 0) {
                        $(this).text($(this).text().substring(0, $(this).text().length - 1));
                    }
                    i++;
                });
            });
        }

        function getMoneyDetial(date) {
            $(".AddDetial").html("");
            $(".nohide").hide();
            $(".loading").show();
            var val = date;
            var html = "";
            var allTr = "";
            $.post("/Handler/SyzyyHandler.ashx?Action=SearchInHospitalMoneyDetial&openid=<%=openid%>&cardNo=" + '<%=CardID%>' + "&date=" + val, function (data) {
                var list = eval("(" + data + ")");
                if (typeof (list) != "undefined") {
                    if (typeof (list.status) == 'undefined') {
                        var temp = '<ul class="pd_list"><li class="tb_head">'
                                   + '<span class="feeType f_green2">费用类型</span>'
                                   + '<span class="feeAmount f_green2">费用金额</span>'
                                   + '<span class="feeNumber f_green2">数量</span>'
                                   + '<span class="feeNumber f_green2">单价</span>'
                               + '</li>';
                        for (var i = 0; i < list.length; i++) {

                            var childTemp = '<li class="tb_body">'
                                            + '<span>{MoneyType}</span>'
                                            + '<span>{Moeny}</span>'
                                            + '<span>{Amount}</span>'
                                            + '<span>{Price}</span>'
                                          + '</li>';
                            allTr += childTemp.replace(/{MoneyType}/, list[i].ITEMNAME)
                                .replace(/{Moeny}/, list[i].TOTAMOUNT)
                                .replace(/{Amount}/, list[i].UNITQUANTITY)
                                .replace(/{Price}/, list[i].PRICE);
                        }
                        html = temp + allTr + '</ul>';
                        $(".AddDetial").html("");
                        $(".AddDetial").append(html);
                        $(".nohide").hide();
                        $(".loading").hide();
                    } else {
                        layer.msg(list.info, {
                            time: 1000 //2秒关闭（如果不配置，默认是3秒）
                        });
                        $(".AddDetial").html("");
                        $(".nohide").show();
                        $(".loading").show();
                    }
                }
            });

        }

        $(function () {
            layui.use('form', function () {
                subText();
                Date.prototype.Format = function (fmt) { //author: meizz
                    var o = {
                        "M+": this.getMonth() + 1, //月份   
                        "d+": this.getDate(), //日   
                        "h+": this.getHours(), //小时   
                        "m+": this.getMinutes(), //分   
                        "s+": this.getSeconds(), //秒   
                        "q+": Math.floor((this.getMonth() + 3) / 3), //季度   
                        "S": this.getMilliseconds() //毫秒   
                    };
                    if (/(y+)/.test(fmt))
                        fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
                    for (var k in o)
                        if (new RegExp("(" + k + ")").test(fmt))
                            fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
                    return fmt;
                }
                var currYear = (new Date()).getFullYear();
                var preDate = new Date(new Date().getTime() - 24 * 60 * 60 * 1000); //前一天
                var hospitalId = "syzyyadmin";
                var opt = {};
                opt.date = {
                    preset: 'date'
                };
                opt.datetime = {
                    preset: 'datetime'
                };
                opt.time = {
                    preset: 'time'
                };
                if (hospitalId == "jnsdermyyadmin") {
                    opt.default = {
                        theme: 'android-ics light', //皮肤样式
                        display: 'modal', //显示方式 
                        mode: 'scroller', //日期选择模式
                        dateFormat: 'yyyy-mm-dd',
                        lang: 'zh',
                        showNow: true,
                        nowText: "今天",
                        minDate: preDate,
                        maxDate: preDate,
                        startYear: currYear, //开始年份
                        endYear: currYear //结束年份

                    };
                } else {
                    opt.default = {
                        theme: 'android-ics light', //皮肤样式
                        display: 'modal', //显示方式 
                        mode: 'scroller', //日期选择模式
                        dateFormat: 'yyyy-mm-dd',
                        lang: 'zh',
                        showNow: true,
                        nowText: "今天",
                        startYear: currYear - 50, //开始年份
                        endYear: currYear + 10 //结束年份

                    };
                }

                $("#USER_AGE").mobiscroll($.extend(opt['date'], opt['default']));
                var dateF = '';
                if (dateF != '') {
                    $("#USER_AGE").scroller('setDate', new Date(dateF), true);
                } else {
                    $("#USER_AGE").scroller('setDate', new Date(), true);
                }

                //获取val
                $("#USER_AGE").change(function () {
                    var val = this.value;
                    var patients = $("#queryFeeInfoForm").serialize();
                    getMoneyDetial(val);
                });

                getMoneyDetial($("#USER_AGE").val());

            });
        });

    </script>



</body>
</html>
